#pragma once
#include "EpilReferenceObject.h"
#include "EpilFunctionType.h"


class EpilNilObject;
class EpilBooleanObject;
class EpilNumberObject;
class EpilStringObject;


class EpilFunctionObject : public EpilReferenceObject
{
	EPIL_OBJECT_DECL( Function );

public:
	EpilFunctionObject( EpilInterpreter * interpreter );
	virtual ~EpilFunctionObject();

	EpilObject *						OperateUnary( EpilUnaryOperator op );
	EpilObject *						OperateBinary( EpilBinaryOperator op, EpilObject * that );

	virtual tstring						ToString() const = 0;
	virtual EpilFunctionType			GetFunctionType() const = 0;
	virtual EpilObjectVector			Invoke( const EpilObjectVector & params ) const = 0;

private:
	EpilObject *						OperateBinaryInternal( EpilBinaryOperator op, EpilNilObject * that );
	EpilObject *						OperateBinaryInternal( EpilBinaryOperator op, EpilBooleanObject * that );
	EpilObject *						OperateBinaryInternal( EpilBinaryOperator op, EpilNumberObject * that );
	EpilObject *						OperateBinaryInternal( EpilBinaryOperator op, EpilStringObject * that );
};